/*
 *  $Id: CallOfEvil.cs 1221 2010-11-30 16:54:52Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Cards001.Darkness.Spells {
    public class CallOfEvil: SelfEnchantmentCard {
        public CallOfEvil(): base("001_d_s_call_of_evil") {
            Level = CompleteLevel.ReadyForTest;
            Element = ElementType.Darkness;
            Value = 100;
            Target = new JogTarget(GetTargetPhrase(), GetJogValue);
            AddManaCost(ElementType.Darkness, 2);
        }

        private static IJogValueProvider GetJogValue(Player player) {
            return new ManaJogValueProvider(player, ElementType.Darkness, 1, 1, -2);
        }

        private int _mana;

        protected override void DoAction(TargetArgs<int> args) {
            _mana = args.Target;
            args.Player.DecrementMana(ElementType.Darkness, _mana);
            base.DoAction(args);
        }
        protected override EnchantmentAffect CreateEnchantment() {
            return new CallOfEvilAffect(_mana);
        }

        private class CallOfEvilAffect: EnchantmentAffect<CallOfEvil> {
            private int _value;

            public CallOfEvilAffect(int value): base(true) {
                DefaultDescription = true;
                _value = value;
                Add(new Affects.FearAura(value));
            }

            public override string DescriptionText {
                get { return Description.GetText(_value); }
            }

            public override Affect Clone() {
                return new CallOfEvilAffect(_value);
            }
        }
    }
}
